home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- Function IsAlpha (strIn As String) As Integer
-
- Dim intChar As Integer
-
- intChar = Asc(Left$(strIn, 1))
-
- IsAlpha = False
-
- If intChar < 65 Then Exit Function
- If intChar > 122 Then Exit Function
- If intChar > 90 And intChar < 97 Then Exit Function
-
- IsAlpha = True
-
- End Function
-
- Function LeftMostWord (strIn) As String
-
- If InStr(strIn, " ") = 0 Then
- LeftMostWord = strIn
- Else
- LeftMostWord = Left$(strIn, InStr(strIn, " ") - 1)
- End If
-
- End Function
-
- Function NextWord (ByVal strIn As String, intFrom As Integer) As String
-
- Dim strTemp As String
- Dim intStart As Integer
-
- If intFrom = 0 Then intFrom = 1
-
- While Not IsAlpha(Mid$(strIn, intFrom, 1)) And intFrom <= Len(strIn)
- intFrom = intFrom + 1
- Wend
-
- If intFrom > Len(strIn) Then
- NextWord = ""
- Exit Function
- End If
-
- intStart = intFrom
-
- While Not Mid$(strIn, intFrom, 1) = " " And intFrom <= Len(strIn)
- intFrom = intFrom + 1
- Wend
-
- NextWord = Mid$(strIn, intStart, intFrom - intStart)
-
- End Function
-
- Function NumOccurrences (ByVal strIn As String, ByVal strSearch As String) As Integer
-
- Dim intCount As Integer
- Dim intPos As Integer
-
- intPos = 0
-
- Do
- intPos = InStr(intPos + 1, strIn, strSearch)
- If intPos > 0 Then
- intCount = intCount + 1
- End If
- Loop While intPos <> 0
-
- End Function
-
- Sub Replace (strSrc As String, strFrom As String, strTo As String)
-
- Do While InStr(strSrc, strFrom)
-
- strSrc = Left$(strSrc, InStr(strSrc, strFrom) - 1) & strTo & Mid$(strSrc, InStr(strSrc, strFrom) + 1)
-
- Loop
-
- End Sub
-
- Function RPad (ByVal strIn As String, intLen As Integer)
-
- ' Create a string from strIn intLen chars long, padded at the RHS with
- ' spaces where necessary. If strIn is longer than intLen chars, use the
- ' leftmost intLen chars.
-
- If Len(strIn) > intLen Then
- RPad = Left$(strIn, intLen)
- Exit Function
- End If
-
- RPad = strIn & Space$(intLen - Len(strIn))
-
- End Function
-
-